package com.geekstudy.week10.server;


import com.geekstudy.rpc.tool.server.RPCServerTool;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.Map;

@RestController
public class RPCController {

    @RequestMapping("/rpcServer")
    public Map<String, String> rpcServer(@RequestParam Map<String, String> paramMap) {
        // Map<String, String> resultMap = new LinkedHashMap<String, String>();
        System.out.println("RPCController ");

        String className = paramMap.get("className");
        String methodName = paramMap.get("methodName");
        RPCServerTool rpcServerTool = new RPCServerTool();

        Map<String, String> resultMap = rpcServerTool.serverInvoke(className, methodName, paramMap);


        return resultMap;
    }
}
